package com.hr.system.service.impl;

import java.util.List;
import com.hr.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hr.system.mapper.SysLeaveMapper;
import com.hr.system.domain.SysLeave;
import com.hr.system.service.ISysLeaveService;
import com.hr.common.core.text.Convert;

/**
 * 请假Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-03-16
 */
@Service
public class SysLeaveServiceImpl implements ISysLeaveService 
{
    @Autowired
    private SysLeaveMapper sysLeaveMapper;

    /**
     * 查询请假
     * 
     * @param leaveId 请假ID
     * @return 请假
     */
    @Override
    public SysLeave selectSysLeaveById(Long leaveId)
    {
        return sysLeaveMapper.selectSysLeaveById(leaveId);
    }

    /**
     * 查询请假列表
     * 
     * @param sysLeave 请假
     * @return 请假
     */
    @Override
    public List<SysLeave> selectSysLeaveList(SysLeave sysLeave)
    {
        return sysLeaveMapper.selectSysLeaveList(sysLeave);
    }

    /**
     * 新增请假
     * 
     * @param sysLeave 请假
     * @return 结果
     */
    @Override
    public int insertSysLeave(SysLeave sysLeave)
    {
        sysLeave.setCreateTime(DateUtils.getNowDate());
        return sysLeaveMapper.insertSysLeave(sysLeave);
    }

    /**
     * 修改请假
     * 
     * @param sysLeave 请假
     * @return 结果
     */
    @Override
    public int updateSysLeave(SysLeave sysLeave)
    {
        return sysLeaveMapper.updateSysLeave(sysLeave);
    }

    /**
     * 删除请假对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteSysLeaveByIds(String ids)
    {
        return sysLeaveMapper.deleteSysLeaveByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除请假信息
     * 
     * @param leaveId 请假ID
     * @return 结果
     */
    @Override
    public int deleteSysLeaveById(Long leaveId)
    {
        return sysLeaveMapper.deleteSysLeaveById(leaveId);
    }

    @Override
    public int approval(long leaveId) {
        return sysLeaveMapper.approval(leaveId);
    }

    @Override
    public int leaderApproval(long leaveId) {
        return sysLeaveMapper.leaderApproval(leaveId);
    }
}
